<?php
/**
 * Created by PhpStorm.
 * User: hebidu
 * Date: 15/12/3
 * Time: 14:26
 */

namespace Test\Controller;


use Api\Service\OAuth2ClientService;

class TestTokenController extends TestController {

    public function index(){
        //TestToken
        $this->display();
    }

    public function test001(){
        if(IS_POST){

            $client_id = I('post.client_id','');
            $client_secret = I('post.client_secret','');
            $config = array(
                    'client_id'=>$client_id,
                    'client_secret'=>$client_secret,
                    'site_url'=>C("SITE_URL"),
            );

            $client = new OAuth2ClientService($config);
            $access_token = $client->getAccessToken();

            dump($access_token);
            exit();
        }

        $this->assign("client_id",CLIENT_ID);
        $this->assign("client_secret",CLIENT_SECRET);

        $this->display();
    }

}